package ooday03;
/*测试类*/
public class Tset {
    public static void main(String[] args) {

        /*狗狗类测试*/
        Dog[] dogs = new Dog[3];
        dogs[0] = new Dog("奥利奥",1,"黄");
        dogs[1] = new Dog("奥利给",2,"白");
        dogs[2] = new Dog("奥斯卡",3,"灰");
        //数组的访问
        System.out.println(dogs[0].name);
        dogs[1].age = 4;
        dogs[2].swim();
        //遍历dogs数组
        for(int i = 0;i< dogs.length;i++){
            System.out.println(dogs[i].name);
            dogs[i].eat();
        }

        /*鸡类测试*/
        Chick[] chicks = new Chick[3];
        chicks[0] = new Chick("小花",2,"白色");
        chicks[1] = new Chick("小兰",3,"黄色");
        chicks[2] = new Chick("小菊",4,"黄白色");
        //数组的访问
        System.out.println(chicks[1].color);
        chicks[0].layEggs();
        //遍历数组
        for(int i = 0;i<chicks.length;i++){
            System.out.println(chicks[i].color);
            chicks[i].eat();
        }

        /*鸡类测试*/
        Fish[] fishs = new Fish[3];
        fishs[0] = new Fish("大鱼",12,"粉色");
        fishs[1] = new Fish("小鱼",13,"蓝色");
        fishs[2] = new Fish("鱼籽",14,"紫色");
        //数组的访问
        System.out.println(fishs[1].age);
        fishs[0].swim();
        //遍历数组
        for(int i = 0;i<fishs.length;i++){
            System.out.println(fishs[i].color);
            fishs[i].eat();
        }
    }
}